{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7d3c1a6e",
   "metadata": {},
   "source": [
    "----------\n",
    "* 本周学习内容：莫金婵\n",
    "* 学习时间： 2021-10-28\n",
    "* week04\n",
    "* [参考的文档](http://www.python.org./doc/)\n",
    "----------\n",
    "\n",
    "# 本周学习内容\n",
    "\n",
    "## 1. 字符串的数值方法\n",
    "\n",
    "> 1. 字符串[序列类型]()\n",
    "> 2. 数值的[数据类型]()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3e4dd155",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'mojinchan'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name = \"mojinchan\"\n",
    "name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "82f55f1e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mojinchan'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 变量. tab键\n",
    "name.capitalize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "76299642",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'                                             mojinchan                                              '"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 居中\n",
    "name.center(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "8297555f",
   "metadata": {},
   "outputs": [],
   "source": [
    "text = \"http://localhost:8889/notebooks/2021-2022/week04/week04_%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%95%B0%E5%80%BC%E6%96%B9%E6%B3%95_%E6%B3%A8%E9%87%8A_%E7%94%A8%E6%88%B7%E8%BE%93%E5%85%A5.ipynb\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4ee41c3f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 检查某一字符/字符串 出现的频次（词频）\n",
    "text.count(\"week04\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "6a03e394",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 判断字符串是否是数值 如果返回 True 说明字符串中所有都是数字\n",
    "text.isdigit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "22add4cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "stud_id = \"2100222\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3c6e0936",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stud_id.isdigit()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3860df15",
   "metadata": {},
   "source": [
    "\\n 表示换行 ， \\t 表示制表符，\\r 表示回车键"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "3a025a7d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mojinchan \n",
      "hallo\n"
     ]
    }
   ],
   "source": [
    "print(\"mojinchan\",\"\\n\"\"hallo\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e17d4e87",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mojinchan \thallo\n"
     ]
    }
   ],
   "source": [
    "print(\"mojinchan\",\"\\t\"\"hallo\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "bdb66fee",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mojinchan \r",
      "hallo\n"
     ]
    }
   ],
   "source": [
    "print(\"mojinchan\",\"\\r\"\"hallo\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dcf1b71d",
   "metadata": {},
   "source": [
    "# 数值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "321562a5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'float'>\n"
     ]
    }
   ],
   "source": [
    "#int\n",
    "classroom = 208\n",
    "PI = 3.1415926\n",
    "print(type(PI))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "03a2fac0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'float'>\n"
     ]
    }
   ],
   "source": [
    "#float\n",
    "PI = 3.1415926\n",
    "print(type(PI))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "14320026",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'complex'>\n"
     ]
    }
   ],
   "source": [
    "# complex\n",
    "complex_value = 2+4j\n",
    "print(type(complex_value))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "ce784d89",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#取整\n",
    "10//7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "ae409717",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#取余\n",
    "10%7"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "93f61c24",
   "metadata": {},
   "source": [
    "一行代码抓取网站表格\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "d6d0f8f7",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "315163ac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[  Operation                                Result Notes\n",
       " 0    x or y         if x is false, then y, else x   (1)\n",
       " 1   x and y         if x is false, then x, else y   (2)\n",
       " 2     not x  if x is false, then True, else False   (3),\n",
       "   Operation                  Meaning\n",
       " 0         <       strictly less than\n",
       " 1        <=       less than or equal\n",
       " 2         >    strictly greater than\n",
       " 3        >=    greater than or equal\n",
       " 4        ==                    equal\n",
       " 5        !=                not equal\n",
       " 6        is          object identity\n",
       " 7    is not  negated object identity,\n",
       "           Operation                                             Result  \\\n",
       " 0             x + y                                     sum of x and y   \n",
       " 1             x - y                              difference of x and y   \n",
       " 2             x * y                                 product of x and y   \n",
       " 3             x / y                                quotient of x and y   \n",
       " 4            x // y                        floored quotient of x and y   \n",
       " 5             x % y                                 remainder of x / y   \n",
       " 6                -x                                          x negated   \n",
       " 7                +x                                        x unchanged   \n",
       " 8            abs(x)                   absolute value or magnitude of x   \n",
       " 9            int(x)                             x converted to integer   \n",
       " 10         float(x)                      x converted to floating point   \n",
       " 11  complex(re, im)  a complex number with real part re, imaginary ...   \n",
       " 12    c.conjugate()                  conjugate of the complex number c   \n",
       " 13     divmod(x, y)                           the pair (x // y, x % y)   \n",
       " 14        pow(x, y)                                   x to the power y   \n",
       " 15           x ** y                                   x to the power y   \n",
       " \n",
       "      Notes Full documentation  \n",
       " 0      NaN                NaN  \n",
       " 1      NaN                NaN  \n",
       " 2      NaN                NaN  \n",
       " 3      NaN                NaN  \n",
       " 4      (1)                NaN  \n",
       " 5      (2)                NaN  \n",
       " 6      NaN                NaN  \n",
       " 7      NaN                NaN  \n",
       " 8      NaN              abs()  \n",
       " 9   (3)(6)              int()  \n",
       " 10  (4)(6)            float()  \n",
       " 11     (6)          complex()  \n",
       " 12     NaN                NaN  \n",
       " 13     (2)           divmod()  \n",
       " 14     (5)              pow()  \n",
       " 15     (5)                NaN  ,\n",
       "        Operation                                             Result\n",
       " 0  math.trunc(x)                            x truncated to Integral\n",
       " 1  round(x[, n])  x rounded to n digits, rounding half to even. ...\n",
       " 2  math.floor(x)                         the greatest Integral <= x\n",
       " 3   math.ceil(x)                            the least Integral >= x,\n",
       "   Operation                           Result   Notes\n",
       " 0     x | y            bitwise or of x and y     (4)\n",
       " 1     x ^ y  bitwise exclusive or of x and y     (4)\n",
       " 2     x & y           bitwise and of x and y     (4)\n",
       " 3    x << n         x shifted left by n bits  (1)(2)\n",
       " 4    x >> n        x shifted right by n bits  (1)(3)\n",
       " 5        ~x           the bits of x inverted     NaN,\n",
       "                Operation                                             Result  \\\n",
       " 0                 x in s     True if an item of s is equal to x, else False   \n",
       " 1             x not in s     False if an item of s is equal to x, else True   \n",
       " 2                  s + t                       the concatenation of s and t   \n",
       " 3         s * n or n * s           equivalent to adding s to itself n times   \n",
       " 4                   s[i]                            ith item of s, origin 0   \n",
       " 5                 s[i:j]                             slice of s from i to j   \n",
       " 6               s[i:j:k]                 slice of s from i to j with step k   \n",
       " 7                 len(s)                                        length of s   \n",
       " 8                 min(s)                                 smallest item of s   \n",
       " 9                 max(s)                                  largest item of s   \n",
       " 10  s.index(x[, i[, j]])  index of the first occurrence of x in s (at or...   \n",
       " 11            s.count(x)              total number of occurrences of x in s   \n",
       " \n",
       "      Notes  \n",
       " 0      (1)  \n",
       " 1      (1)  \n",
       " 2   (6)(7)  \n",
       " 3   (2)(7)  \n",
       " 4      (3)  \n",
       " 5   (3)(4)  \n",
       " 6   (3)(5)  \n",
       " 7      NaN  \n",
       " 8      NaN  \n",
       " 9      NaN  \n",
       " 10     (8)  \n",
       " 11     NaN  ,\n",
       "                 Operation                                             Result  \\\n",
       " 0                s[i] = x                       item i of s is replaced by x   \n",
       " 1              s[i:j] = t  slice of s from i to j is replaced by the cont...   \n",
       " 2              del s[i:j]                                same as s[i:j] = []   \n",
       " 3            s[i:j:k] = t  the elements of s[i:j:k] are replaced by those...   \n",
       " 4            del s[i:j:k]     removes the elements of s[i:j:k] from the list   \n",
       " 5             s.append(x)  appends x to the end of the sequence (same as ...   \n",
       " 6               s.clear()        removes all items from s (same as del s[:])   \n",
       " 7                s.copy()         creates a shallow copy of s (same as s[:])   \n",
       " 8   s.extend(t) or s += t  extends s with the contents of t (for the most...   \n",
       " 9                  s *= n       updates s with its contents repeated n times   \n",
       " 10         s.insert(i, x)  inserts x into s at the index given by i (same...   \n",
       " 11    s.pop() or s.pop(i)  retrieves the item at i and also removes it fr...   \n",
       " 12            s.remove(x)  remove the first item from s where s[i] is equ...   \n",
       " 13            s.reverse()                   reverses the items of s in place   \n",
       " \n",
       "    Notes  \n",
       " 0    NaN  \n",
       " 1    NaN  \n",
       " 2    NaN  \n",
       " 3    (1)  \n",
       " 4    NaN  \n",
       " 5    NaN  \n",
       " 6    (5)  \n",
       " 7    (5)  \n",
       " 8    NaN  \n",
       " 9    (6)  \n",
       " 10   NaN  \n",
       " 11   (2)  \n",
       " 12   (3)  \n",
       " 13   (4)  ,\n",
       "    Representation                  Description\n",
       " 0              \\n                    Line Feed\n",
       " 1              \\r              Carriage Return\n",
       " 2            \\r\\n  Carriage Return + Line Feed\n",
       " 3      \\v or \\x0b              Line Tabulation\n",
       " 4      \\f or \\x0c                    Form Feed\n",
       " 5            \\x1c               File Separator\n",
       " 6            \\x1d              Group Separator\n",
       " 7            \\x1e             Record Separator\n",
       " 8            \\x85  Next Line (C1 Control Code)\n",
       " 9          \\u2028               Line Separator\n",
       " 10         \\u2029          Paragraph Separator,\n",
       "   Flag                                            Meaning\n",
       " 0  '#'  The value conversion will use the “alternate f...\n",
       " 1  '0'  The conversion will be zero padded for numeric...\n",
       " 2  '-'  The converted value is left adjusted (override...\n",
       " 3  ' '  (a space) A blank should be left before a posi...\n",
       " 4  '+'  A sign character ('+' or '-') will precede the...,\n",
       "    Conversion                                            Meaning Notes\n",
       " 0         'd'                            Signed integer decimal.   NaN\n",
       " 1         'i'                            Signed integer decimal.   NaN\n",
       " 2         'o'                                Signed octal value.   (1)\n",
       " 3         'u'            Obsolete type – it is identical to 'd'.   (6)\n",
       " 4         'x'                    Signed hexadecimal (lowercase).   (2)\n",
       " 5         'X'                    Signed hexadecimal (uppercase).   (2)\n",
       " 6         'e'     Floating point exponential format (lowercase).   (3)\n",
       " 7         'E'     Floating point exponential format (uppercase).   (3)\n",
       " 8         'f'                     Floating point decimal format.   (3)\n",
       " 9         'F'                     Floating point decimal format.   (3)\n",
       " 10        'g'  Floating point format. Uses lowercase exponent...   (4)\n",
       " 11        'G'  Floating point format. Uses uppercase exponent...   (4)\n",
       " 12        'c'  Single character (accepts integer or single ch...   NaN\n",
       " 13        'r'  String (converts any Python object using repr()).   (5)\n",
       " 14        's'   String (converts any Python object using str()).   (5)\n",
       " 15        'a'  String (converts any Python object using ascii...   (5)\n",
       " 16        '%'  No argument is converted, results in a '%' cha...   NaN,\n",
       "   Flag                                            Meaning\n",
       " 0  '#'  The value conversion will use the “alternate f...\n",
       " 1  '0'  The conversion will be zero padded for numeric...\n",
       " 2  '-'  The converted value is left adjusted (override...\n",
       " 3  ' '  (a space) A blank should be left before a posi...\n",
       " 4  '+'  A sign character ('+' or '-') will precede the...,\n",
       "    Conversion                                            Meaning Notes\n",
       " 0         'd'                            Signed integer decimal.   NaN\n",
       " 1         'i'                            Signed integer decimal.   NaN\n",
       " 2         'o'                                Signed octal value.   (1)\n",
       " 3         'u'            Obsolete type – it is identical to 'd'.   (8)\n",
       " 4         'x'                    Signed hexadecimal (lowercase).   (2)\n",
       " 5         'X'                    Signed hexadecimal (uppercase).   (2)\n",
       " 6         'e'     Floating point exponential format (lowercase).   (3)\n",
       " 7         'E'     Floating point exponential format (uppercase).   (3)\n",
       " 8         'f'                     Floating point decimal format.   (3)\n",
       " 9         'F'                     Floating point decimal format.   (3)\n",
       " 10        'g'  Floating point format. Uses lowercase exponent...   (4)\n",
       " 11        'G'  Floating point format. Uses uppercase exponent...   (4)\n",
       " 12        'c'  Single byte (accepts integer or single byte ob...   NaN\n",
       " 13        'b'  Bytes (any object that follows the buffer prot...   (5)\n",
       " 14        's'  's' is an alias for 'b' and should only be use...   (6)\n",
       " 15        'a'  Bytes (converts any Python object using repr(o...   (5)\n",
       " 16        'r'  'r' is an alias for 'a' and should only be use...   (7)\n",
       " 17        '%'  No argument is converted, results in a '%' cha...   NaN]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_html(\"https://docs.python.org/3/library/stdtypes.html#muneric-types-int-float-complex\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "59c95444",
   "metadata": {},
   "source": [
    "for循环\n",
    "[range](https://docs.python.org/3/library/stdtypes.html?highlight=range#range)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "0e7d78f8",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "h\n",
      "a\n",
      "l\n",
      "l\n",
      "o\n"
     ]
    }
   ],
   "source": [
    "# 循环遍历：每一个元素依次输出\n",
    "for i in \"hallo\":\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "ea561acb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(0, 5)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 自动生成一系列的数值，生成从0开始 每一个增加1的一系列数值\n",
    "# range()只有一个值： 1. 从0开始生产 这个值的个数的数值\n",
    "range(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "0f7038b8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list (range(5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "9a7bc6e2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# range(5,10) 5: start(起始值) 10;stop-start 个数值\n",
    "list(range(5,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c6f0039c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[5, 7, 9]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(5,10,2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "c0c3f9bf",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 抓取新闻\n",
    "# https://www.nfu.edu.cn/xydt/index5.htm\n",
    "\n",
    "url_01 = \"https://www.nfu.edu.cn/xxyw/index.htm\"\n",
    "# url_02 = 0-96的数字\n",
    "url_03 = \".htm\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "57248b97",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.nfu.edu.cn/xxyw/index.htm.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm1.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm2.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm3.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm4.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm5.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm6.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm7.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm8.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm9.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm10.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm11.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm12.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm13.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm14.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm15.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm16.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm17.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm18.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm19.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm20.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm21.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm22.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm23.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm24.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm25.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm26.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm27.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm28.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm29.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm30.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm31.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm32.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm33.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm34.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm35.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm36.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm37.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm38.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm39.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm40.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm41.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm42.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm43.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm44.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm45.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm46.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm47.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm48.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm49.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm50.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm51.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm52.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm53.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm54.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm55.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm56.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm57.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm58.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm59.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm60.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm61.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm62.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm63.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm64.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm65.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm66.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm67.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm68.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm69.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm70.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm71.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm72.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm73.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm74.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm75.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm76.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm77.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm78.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm79.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm80.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm81.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm82.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm83.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm84.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm85.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm86.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm87.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm88.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm89.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm90.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm91.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm92.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm93.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm94.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm95.htm\n",
      "https://www.nfu.edu.cn/xxyw/index.htm96.htm\n"
     ]
    }
   ],
   "source": [
    "for i in range(97):\n",
    "    #中间的操作过程：统一\n",
    "    \n",
    "    if i == 0:\n",
    "        print(url_01+url_03)\n",
    "    else:\n",
    "        print(url_01+ str(i) + url_03)\n",
    "        \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "c4656b77",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1. random随机数实验\n",
    "import random   # 调用模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "f54a02db",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module random:\n",
      "\n",
      "NAME\n",
      "    random - Random variable generators.\n",
      "\n",
      "MODULE REFERENCE\n",
      "    https://docs.python.org/3.8/library/random\n",
      "    \n",
      "    The following documentation is automatically generated from the Python\n",
      "    source files.  It may be incomplete, incorrect or include features that\n",
      "    are considered implementation detail and may vary between Python\n",
      "    implementations.  When in doubt, consult the module reference at the\n",
      "    location listed above.\n",
      "\n",
      "DESCRIPTION\n",
      "        integers\n",
      "        --------\n",
      "               uniform within range\n",
      "    \n",
      "        sequences\n",
      "        ---------\n",
      "               pick random element\n",
      "               pick random sample\n",
      "               pick weighted random sample\n",
      "               generate random permutation\n",
      "    \n",
      "        distributions on the real line:\n",
      "        ------------------------------\n",
      "               uniform\n",
      "               triangular\n",
      "               normal (Gaussian)\n",
      "               lognormal\n",
      "               negative exponential\n",
      "               gamma\n",
      "               beta\n",
      "               pareto\n",
      "               Weibull\n",
      "    \n",
      "        distributions on the circle (angles 0 to 2pi)\n",
      "        ---------------------------------------------\n",
      "               circular uniform\n",
      "               von Mises\n",
      "    \n",
      "    General notes on the underlying Mersenne Twister core generator:\n",
      "    \n",
      "    * The period is 2**19937-1.\n",
      "    * It is one of the most extensively tested generators in existence.\n",
      "    * The random() method is implemented in C, executes in a single Python step,\n",
      "      and is, therefore, threadsafe.\n",
      "\n",
      "CLASSES\n",
      "    _random.Random(builtins.object)\n",
      "        Random\n",
      "            SystemRandom\n",
      "    \n",
      "    class Random(_random.Random)\n",
      "     |  Random(x=None)\n",
      "     |  \n",
      "     |  Random number generator base class used by bound module functions.\n",
      "     |  \n",
      "     |  Used to instantiate instances of Random to get generators that don't\n",
      "     |  share state.\n",
      "     |  \n",
      "     |  Class Random can also be subclassed if you want to use a different basic\n",
      "     |  generator of your own devising: in that case, override the following\n",
      "     |  methods:  random(), seed(), getstate(), and setstate().\n",
      "     |  Optionally, implement a getrandbits() method so that randrange()\n",
      "     |  can cover arbitrarily large ranges.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  getstate(self)\n",
      "     |      Return internal state; can be passed to setstate() later.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1, _int=<class 'int'>)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      To choose a sample in a range of integers, use range as an argument.\n",
      "     |      This is especially fast and space efficient for sampling from a\n",
      "     |      large population:   sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  seed(self, a=None, version=2)\n",
      "     |      Initialize internal state from hashable object.\n",
      "     |      \n",
      "     |      None or no argument seeds from current time or from an operating\n",
      "     |      system specific randomness source if available.\n",
      "     |      \n",
      "     |      If *a* is an int, all bits are used.\n",
      "     |      \n",
      "     |      For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "     |      bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "     |      sequences from older versions of Python), the algorithm for str and\n",
      "     |      bytes generates a narrower range of seeds.\n",
      "     |  \n",
      "     |  setstate(self, state)\n",
      "     |      Restore internal state from object returned by getstate().\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods defined here:\n",
      "     |  \n",
      "     |  __init_subclass__(**kwargs) from builtins.type\n",
      "     |      Control how subclasses generate random integers.\n",
      "     |      \n",
      "     |      The algorithm a subclass can use depends on the random() and/or\n",
      "     |      getrandbits() implementation available to it and determines\n",
      "     |      whether it can generate random integers from arbitrarily large\n",
      "     |      ranges.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  getrandbits(self, k, /)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  random(self, /)\n",
      "     |      random() -> x in the interval [0, 1).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "    \n",
      "    class SystemRandom(Random)\n",
      "     |  SystemRandom(x=None)\n",
      "     |  \n",
      "     |  Alternate random number generator using sources provided\n",
      "     |  by the operating system (such as /dev/urandom on Unix or\n",
      "     |  CryptGenRandom on Windows).\n",
      "     |  \n",
      "     |   Not available on all systems (see os.urandom() for details).\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      SystemRandom\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  getrandbits(self, k)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  getstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  random(self)\n",
      "     |      Get the next random number in the range [0.0, 1.0).\n",
      "     |  \n",
      "     |  seed(self, *args, **kwds)\n",
      "     |      Stub method.  Not used for a system random number generator.\n",
      "     |  \n",
      "     |  setstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from Random:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1, _int=<class 'int'>)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      To choose a sample in a range of integers, use range as an argument.\n",
      "     |      This is especially fast and space efficient for sampling from a\n",
      "     |      large population:   sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods inherited from Random:\n",
      "     |  \n",
      "     |  __init_subclass__(**kwargs) from builtins.type\n",
      "     |      Control how subclasses generate random integers.\n",
      "     |      \n",
      "     |      The algorithm a subclass can use depends on the random() and/or\n",
      "     |      getrandbits() implementation available to it and determines\n",
      "     |      whether it can generate random integers from arbitrarily large\n",
      "     |      ranges.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from Random:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes inherited from Random:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "\n",
      "FUNCTIONS\n",
      "    betavariate(alpha, beta) method of Random instance\n",
      "        Beta distribution.\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        Returned values range between 0 and 1.\n",
      "    \n",
      "    choice(seq) method of Random instance\n",
      "        Choose a random element from a non-empty sequence.\n",
      "    \n",
      "    choices(population, weights=None, *, cum_weights=None, k=1) method of Random instance\n",
      "        Return a k sized list of population elements chosen with replacement.\n",
      "        \n",
      "        If the relative weights or cumulative weights are not specified,\n",
      "        the selections are made with equal probability.\n",
      "    \n",
      "    expovariate(lambd) method of Random instance\n",
      "        Exponential distribution.\n",
      "        \n",
      "        lambd is 1.0 divided by the desired mean.  It should be\n",
      "        nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "        a reserved word in Python.)  Returned values range from 0 to\n",
      "        positive infinity if lambd is positive, and from negative\n",
      "        infinity to 0 if lambd is negative.\n",
      "    \n",
      "    gammavariate(alpha, beta) method of Random instance\n",
      "        Gamma distribution.  Not the gamma function!\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        \n",
      "        The probability distribution function is:\n",
      "        \n",
      "                    x ** (alpha - 1) * math.exp(-x / beta)\n",
      "          pdf(x) =  --------------------------------------\n",
      "                      math.gamma(alpha) * beta ** alpha\n",
      "    \n",
      "    gauss(mu, sigma) method of Random instance\n",
      "        Gaussian distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.  This is\n",
      "        slightly faster than the normalvariate() function.\n",
      "        \n",
      "        Not thread-safe without a lock around calls.\n",
      "    \n",
      "    getrandbits(k, /) method of Random instance\n",
      "        getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "    \n",
      "    getstate() method of Random instance\n",
      "        Return internal state; can be passed to setstate() later.\n",
      "    \n",
      "    lognormvariate(mu, sigma) method of Random instance\n",
      "        Log normal distribution.\n",
      "        \n",
      "        If you take the natural logarithm of this distribution, you'll get a\n",
      "        normal distribution with mean mu and standard deviation sigma.\n",
      "        mu can have any value, and sigma must be greater than zero.\n",
      "    \n",
      "    normalvariate(mu, sigma) method of Random instance\n",
      "        Normal distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.\n",
      "    \n",
      "    paretovariate(alpha) method of Random instance\n",
      "        Pareto distribution.  alpha is the shape parameter.\n",
      "    \n",
      "    randint(a, b) method of Random instance\n",
      "        Return random integer in range [a, b], including both end points.\n",
      "    \n",
      "    random() method of Random instance\n",
      "        random() -> x in the interval [0, 1).\n",
      "    \n",
      "    randrange(start, stop=None, step=1, _int=<class 'int'>) method of Random instance\n",
      "        Choose a random item from range(start, stop[, step]).\n",
      "        \n",
      "        This fixes the problem with randint() which includes the\n",
      "        endpoint; in Python this is usually not what you want.\n",
      "    \n",
      "    sample(population, k) method of Random instance\n",
      "        Chooses k unique random elements from a population sequence or set.\n",
      "        \n",
      "        Returns a new list containing elements from the population while\n",
      "        leaving the original population unchanged.  The resulting list is\n",
      "        in selection order so that all sub-slices will also be valid random\n",
      "        samples.  This allows raffle winners (the sample) to be partitioned\n",
      "        into grand prize and second place winners (the subslices).\n",
      "        \n",
      "        Members of the population need not be hashable or unique.  If the\n",
      "        population contains repeats, then each occurrence is a possible\n",
      "        selection in the sample.\n",
      "        \n",
      "        To choose a sample in a range of integers, use range as an argument.\n",
      "        This is especially fast and space efficient for sampling from a\n",
      "        large population:   sample(range(10000000), 60)\n",
      "    \n",
      "    seed(a=None, version=2) method of Random instance\n",
      "        Initialize internal state from hashable object.\n",
      "        \n",
      "        None or no argument seeds from current time or from an operating\n",
      "        system specific randomness source if available.\n",
      "        \n",
      "        If *a* is an int, all bits are used.\n",
      "        \n",
      "        For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "        bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "        sequences from older versions of Python), the algorithm for str and\n",
      "        bytes generates a narrower range of seeds.\n",
      "    \n",
      "    setstate(state) method of Random instance\n",
      "        Restore internal state from object returned by getstate().\n",
      "    \n",
      "    shuffle(x, random=None) method of Random instance\n",
      "        Shuffle list x in place, and return None.\n",
      "        \n",
      "        Optional argument random is a 0-argument function returning a\n",
      "        random float in [0.0, 1.0); if it is the default None, the\n",
      "        standard random.random will be used.\n",
      "    \n",
      "    triangular(low=0.0, high=1.0, mode=None) method of Random instance\n",
      "        Triangular distribution.\n",
      "        \n",
      "        Continuous distribution bounded by given lower and upper limits,\n",
      "        and having a given mode value in-between.\n",
      "        \n",
      "        http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "    \n",
      "    uniform(a, b) method of Random instance\n",
      "        Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "    \n",
      "    vonmisesvariate(mu, kappa) method of Random instance\n",
      "        Circular data distribution.\n",
      "        \n",
      "        mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "        kappa is the concentration parameter, which must be greater than or\n",
      "        equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "        to a uniform random angle over the range 0 to 2*pi.\n",
      "    \n",
      "    weibullvariate(alpha, beta) method of Random instance\n",
      "        Weibull distribution.\n",
      "        \n",
      "        alpha is the scale parameter and beta is the shape parameter.\n",
      "\n",
      "DATA\n",
      "    __all__ = ['Random', 'seed', 'random', 'uniform', 'randint', 'choice',...\n",
      "\n",
      "FILE\n",
      "    d:\\py\\lib\\random.py\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "7cc01826",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.49680214509682896"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "2f57f185",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "18\n",
      "70\n",
      "53\n",
      "17\n",
      "71\n",
      "35\n",
      "54\n",
      "21\n",
      "99\n",
      "30\n"
     ]
    }
   ],
   "source": [
    "for i in range(10):\n",
    "    print (round(random.random()*100,))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "c5c34930",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "unexpected EOF while parsing (<ipython-input-43-78beaab1e023>, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-43-78beaab1e023>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m    print(round(random.randint(1,6))\u001b[0m\n\u001b[1;37m                                    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "66e20790",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-45-69d0fca5c00c>, line 5)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-45-69d0fca5c00c>\"\u001b[1;36m, line \u001b[1;32m5\u001b[0m\n\u001b[1;33m    odds = [,13,5,7,9,11,13,15,,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\u001b[0m\n\u001b[1;37m            ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "import random\n",
    "import time\n",
    "\n",
    "odds = [,13,5,7,9,11,13,15,,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "for i in range(5):\n",
    "    # for + range 决定了 for循环过程 （只要是和for有一个tab键距离的代码块）的次数\n",
    "    right_this_second = datetime.today().second\n",
    "    # 使用datetime模块取获取当前时间节点的秒钟数值：datetime.today().second\n",
    "    \n",
    "    print(\"------------\\n 当前时间秒数：\"，right_this_second)\n",
    "    \n",
    "    if right_this_second in odds:\n",
    "        #判断 秒数是否是\n",
    "        print(\"this second seems a little odd\")\n",
    "        #\n",
    "        vait_time = random.randint(1,5)\n",
    "        \n",
    "        print(\"本次等待时间轴数：\"，wait_time)\n",
    "        \n",
    "        #随机数 + time.sleep(随机数)决定\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9a77a55b",
   "metadata": {},
   "source": [
    "# 3.注释\n",
    "> 1. 单行注释: #\n",
    "> 2. 多行注释：\"\"\" \"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "9e3d001c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 全部+# 快捷键：ctrl+/\n",
    "\n",
    "\n",
    "#import random \n",
    "#wait_time = random.randint(1,60)\n",
    "#print(wait_time)\n",
    "\n",
    "#word = \"bottles\"\n",
    "#print(word)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "c7dbeba5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hallo\n"
     ]
    }
   ],
   "source": [
    "\"\"\"import random \n",
    "wait_time = random.randint(1,60)\n",
    "print(wait_time)\n",
    "\n",
    "word = \"bottles\"\n",
    "print(word)\"\"\"\n",
    "\n",
    "\n",
    "print(\"hallo\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e3b52e28",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
